* %GTK_STYLE_PROVIDER_PRIORITY_USER priority.
*/
+#define CURSOR_ASPECT_RATIO (0.04)
typedef struct PropertyValue PropertyValue;
struct PropertyValue
{
GdkRGBA primary_color;
GdkRGBA secondary_color;
- gfloat cursor_aspect_ratio;
gint stem_width;
gint offset;
* propagate the changes to gtktextview.c:text_window_invalidate_cursors().
*/
- gtk_style_context_get_style (context,
- "cursor-aspect-ratio", &cursor_aspect_ratio,
- NULL);
-
- stem_width = height * cursor_aspect_ratio + 1;
+ stem_width = height * CURSOR_ASPECT_RATIO + 1;
/* put (stem_width % 2) on the proper side of the cursor */
if (direction == PANGO_DIRECTION_LTR)
}
}
-/**
- * gtk_draw_insertion_cursor:
- * @widget: a #GtkWidget
- * @cr: cairo context to draw to
- * @location: location where to draw the cursor (@location->width is ignored)
- * @is_primary: if the cursor should be the primary cursor color.
- * @direction: whether the cursor is left-to-right or
- * right-to-left. Should never be #GTK_TEXT_DIR_NONE
- * @draw_arrow: %TRUE to draw a directional arrow on the
- * cursor. Should be %FALSE unless the cursor is split.
- *
- * Draws a text caret on @cr at @location. This is not a style function
- * but merely a convenience function for drawing the standard cursor shape.
- *
- * Since: 3.0
- * Deprecated: 3.4: Use gtk_render_insertion_cursor() instead.
- */
-void
-gtk_draw_insertion_cursor (GtkWidget *widget,
- cairo_t *cr,
- const GdkRectangle *location,
- gboolean is_primary,
- GtkTextDirection direction,
- gboolean draw_arrow)
-{
- GtkStyleContext *context;
-
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (cr != NULL);
- g_return_if_fail (location != NULL);
- g_return_if_fail (direction != GTK_TEXT_DIR_NONE);
-
- context = gtk_widget_get_style_context (widget);
-
- draw_insertion_cursor (context, cr,
- location->x, location->y, location->height,
- is_primary,
- (direction == GTK_TEXT_DIR_RTL) ? PANGO_DIRECTION_RTL : PANGO_DIRECTION_LTR,
- draw_arrow);
-}
-
/**
* gtk_style_context_get_change:
* @context: the context to query
PangoLayout *layout,
int index,
PangoDirection direction);
-GDK_DEPRECATED_IN_3_4
-void gtk_draw_insertion_cursor (GtkWidget *widget,
- cairo_t *cr,
- const GdkRectangle *location,
- gboolean is_primary,
- GtkTextDirection direction,
- gboolean draw_arrow);
typedef enum {
GTK_STYLE_CONTEXT_PRINT_NONE = 0,
GTK_TYPE_WIDGET_HELP_TYPE,
GTK_WIDGET_HELP_WHATS_THIS);
- gtk_widget_class_install_style_property (klass,
- g_param_spec_boolean ("window-dragging",
- P_("Window dragging"),
- P_("Whether windows can be dragged and maximized by clicking on empty areas"),
- FALSE,
- GTK_PARAM_READABLE));
-
gtk_widget_class_set_accessible_type (klass, GTK_TYPE_WIDGET_ACCESSIBLE);
gtk_widget_class_set_css_name (klass, "widget");
}
{
case GTK_WINDOW_REGION_CONTENT:
if (event_widget != widget)
- gtk_widget_style_get (event_widget, "window-dragging", &window_drag, NULL);
+ {
+ /* TODO: Have some way of enabling/disabling window-dragging on random widgets */
+ }
if (!window_drag)
{
{
GdkEventSequence *sequence;
GtkWindowRegion region;
- GtkWidget *event_widget;
- gboolean widget_drag;
+ gboolean widget_drag = FALSE;
const GdkEvent *event;
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
/* Claim it */
break;
case GTK_WINDOW_REGION_CONTENT:
- event_widget = gtk_get_event_widget ((GdkEvent *) event);
-
- gtk_widget_style_get (event_widget, "window-dragging", &widget_drag, NULL);
+ /* TODO: Have some way of enabling/disabling window-dragging on random widgets */
if (!widget_drag)
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
provider = gtk_css_provider_new ();
g_signal_connect (provider, "parsing-error",
G_CALLBACK (assert_section_is_not_null), NULL);
- gtk_css_provider_load_from_data (provider, "* { -GtkWidget-window-dragging: random garbage goes here; }", -1, NULL);
+ gtk_css_provider_load_from_data (provider, "* { -GtkEntry-invisible-char: random garbage goes here; }", -1, NULL);
- widget_class = g_type_class_ref (GTK_TYPE_WIDGET);
- pspec = gtk_widget_class_find_style_property (widget_class, "window-dragging");
+ widget_class = g_type_class_ref (GTK_TYPE_ENTRY);
+ pspec = gtk_widget_class_find_style_property (widget_class, "invisible-char");
g_assert (pspec);
path = gtk_widget_path_new ();
- gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
+ gtk_widget_path_append_type (path, GTK_TYPE_ENTRY);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
gtk_style_provider_get_style_property (GTK_STYLE_PROVIDER (provider), path, 0, pspec, &value);